﻿namespace OneWorks.Test.Other.TestUtils.QrCode
{
    using System.Drawing;
    using System.Drawing.Imaging;
    using System.IO;
    using Gma.QrCodeNet.Encoding.Windows.Render;
    using Gma.QrCodeNet.Encoding;
    
    using NUnit.Framework;

    public class Simple
    {
        [Test]
        public void Demo()
        {
            QrEncoder encoder = new QrEncoder(ErrorCorrectionLevel.M);
            QrCode qrCode;
            encoder.TryEncode("http://www.example.com", out qrCode);
            GraphicsRenderer gRenderer = new GraphicsRenderer(
                new FixedModuleSize(1, QuietZoneModules.Zero), Brushes.Black, Brushes.White);             
            FileStream fileStream = new FileStream(@"C:\temp\" + System.Guid.NewGuid() + ".png", FileMode.Create);
            gRenderer.WriteToStream(qrCode.Matrix, ImageFormat.Png, fileStream);
            fileStream.Flush();
            fileStream.Close();

            
        }
    }
}
